package com.itheima.day08;

import java.util.ArrayList;

/*
测试 ArrayList 和 LinkedList 在数据达到1000w 以后的性能
 */
public class Test02 {


    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<Integer>();

        for (int i = 0; i < 10000000; i++) {

            list.add(i);
        }

        //增
        long start = System.currentTimeMillis();
        //头插 100 2165
      /*  for (int i = 0; i < 100; i++) {
            list.add(0,i);
        }*/
      //尾插  10w   10
     /*   for (int i = 0; i < 100000; i++) {
            list.add(i);
        }
*/
     //中间插入  100  1001
        for (int i = 0; i < 100; i++) {
            list.add(5000000,i);
        }
        long end = System.currentTimeMillis();

        System.out.println(end-start);
    }

}
